#include "../include/threadPool.h"

//  接收token 
int recvToken(int sockfd, char *token) {
    train_t train;
    bzero(&train,sizeof(train));
    recv(sockfd,&train.flag,sizeof(train.flag),0);
    if(train.flag != -1){
        fprintf(stderr, "Invalid flag received: %d\n", train.flag);
        return -1;
    }
    recv(sockfd,&train.length,sizeof(train.length),0);
    recv(sockfd,&train.data,train.length,MSG_NOSIGNAL);
    memcpy(token,train.data,sizeof(train.data));

    return 0;
    
}
